/*
 * @Author: 小花
 * @Date: 2022-05-27 11:57:57
 * @LastEditors: 小花
 * @LastEditTime: 2022-05-28 11:43:08
 * @FilePath: /permission_client/src/model/RoleView.ts
 * @Description: 角色
 */

import { ElTree, FormInstance } from 'element-plus'
import { IMenu } from './MenuView'

export interface IRole {
  id: string,
  roleName: string,
  roleCode: string,
  description: string,
  createBy?: string,
  createTime?: string,
  updateBy?: string,
  updateTime?: string
}

export interface IPermission {
  id?: string,
  roleId: string,
  permissionId: string,
}

export const defaultProps = {
  children: 'children',
  label: 'name'
}

export default class RoleView {
  roleList = [] as IRole[]
  permissionList = [] as IPermission[]
  menuList = [] as IMenu[]
  originalMenuList = [] as IMenu[]
  tableSearchValue = ''
  tableLayout = 'auto'
  updateRoledialog = {
    dialogFormVisible: false,
    ruleFormRef: {} as FormInstance,
    dialogConfig: {
      title: ''
    },
    form: {} as IRole
  }

  authorizationDialog = {
    dialogTreeVisible: false,
    selectTreeRef: {} as InstanceType<typeof ElTree>,
    dialogConfig: {
      title: ''
    },
    form: {} as IRole
  }

  pagination = {
    // 每页显示条目个数
    pageSize: 10,
    // 每页显示个数选择器的选项设置
    pageSizes: [10, 30, 80, 120],
    // 设置最大页码按钮数
    pagerCount: 5,
    // 当前页数
    currentPage: 1,
    // 总条目数
    total: 0
  }
}
